{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox-title">
        <h5>编辑</h5>
    </div>
    <div class="ibox-content layui-form">
        <div class="layui-row layui-col-space10 layui-form-item ">

            <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                <label class="layui-form-label">名称：</label>
                <div class="layui-input-block">
                    <input type="text" name="star_name" lay-verify="required" placeholder="名称" class="layui-input" value="{$star.star_name}">
                </div>
            </div>

            <div class="layui-form-item layui-col-md-offset1 layui-col-md8 form-group">
                <label class="layui-form-label">状态：</label>
                <div class="layui-input-block">
                    <input type="radio" name="star_status" value="1" {$star.star_status==1?'checked':''} class="layui-input" title="启用"/>
                    <input type="radio" name="star_status" value="2" {$star.star_status==2?'checked':''} class="layui-input" title="禁用"/>
                </div>
            </div>

            <input type="hidden" value="{$star.star_id}" name="star_id">

            <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit="" lay-filter="component-form-element">保存
                    </button>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    layui.use(['form'], function() {
        var form = layui.form;
        form.on('submit(component-form-element)', function (data) {
            $('.layui-btn').addClass('layui-disabled').attr('disabled','disabled');
            $.ajax({
                url:"{:url('updateStar')}",
                type:'post',
                dataType:'json',
                data:data.field,
                success:function(res){
                    if (res.code == 200) {
                        layer.msg(res.msg,{icon:1,time:1500,shade:0.1},function(index){
                            wk.layer_close();
                        })
                    } else {
                        wk.error(res.msg,'','$(".layui-btn").removeClass(\'layui-disabled\').removeAttr(\'disabled\')');
                    }
                }
            })
        });
    });
</script>
</body>
</html>